#include "Function.hpp"
#include "EquationSolver.hpp"
#include <iostream>
#include <cmath>

const double Pi = acos(-1.);
using namespace std;

class F: public Function {
public:
    double operator()(double x) const override {
        return 0.5 * Pi - Pi * asin(x) - x * sqrt(1 - x * x) - 1.24;
    }
};

void solve_with_bisection() {
    cout << "Solving with Bisection Method:" << endl;
    Bisection_Method solver(F(), 0, 1);
    double root = solver.solve();
    cout << "Root found: " << root << endl;
}

void solve_with_newton() {
    cout << "Solving with Newton's Method:" << endl;
    Newton_Method solver(F(), 0.5);
    double root = solver.solve();
    cout << "Root found: " << root << endl;
}

void solve_with_secant() {
    cout << "Solving with Secant Method:" << endl;
    Secant_Method solver(F(), 0, 1);
    double root = solver.solve();
    cout << "Root found: " << root << endl;
}

int main() {
    solve_with_bisection();
    solve_with_newton();
    solve_with_secant();
    return 0;
}
